package com.main.ok.test;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.greenline.epay.taikang.service.CrmCardService;
import com.greenline.epay.taikang.service.PortalCustomerApplyService;
import com.greenline.epay.taikang.service.TaikangInsuranceService;
import com.greenline.epay.taikang.service.TaikangLogService;
import com.greenline.epay.taikang.service.UserAuthenticationService;
import com.greenline.epay.taikang.service.dto.BaseResponse;
import com.greenline.epay.taikang.service.dto.CardChargeDTO;
import com.greenline.epay.taikang.service.dto.CardInfoDTO;
import com.greenline.epay.taikang.service.dto.CardValidDTO;
import com.greenline.epay.taikang.service.dto.CheckResponse;
import com.greenline.epay.taikang.service.dto.CommonUserInfoDTO;
//import com.greenline.epay.taikang.service.dto.CommonUserInfoDTO;
//import com.greenline.epay.taikang.service.dto.CommonUserInfoDTO;
import com.greenline.epay.taikang.service.dto.CustomerApplyDTO;
import com.greenline.epay.taikang.service.dto.CustomerApplyRequest;
import com.greenline.epay.taikang.service.dto.ResponseCode;
import com.greenline.epay.taikang.service.dto.ResponseDTO;
import com.greenline.epay.taikang.service.dto.ServiceDTO;
import com.greenline.epay.taikang.service.dto.ServiceLogRequest;
import com.greenline.epay.taikang.service.dto.ServiceLogRequestDTO;
import com.greenline.epay.taikang.service.dto.TaikangInsuranceRequest;
import com.greenline.epay.taikang.service.dto.TaikangInsuranceResponse;
import com.greenline.epay.taikang.service.dto.TelcomUserDTO;
import com.greenline.epay.taikang.service.dto.UserInfoRequest;
import com.greenline.epay.taikang.service.dto.UserInfoRequestDTO;
import com.greenline.epay.taikang.service.dto.query.CustomerApplyQueryDTO;
import com.greenline.epay.taikang.service.dto.query.QueryResultDTO;

import demo.service.dubbo.UserService;

public class CardServiceMain {

    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

        CrmCardService cardService = (CrmCardService) ctx.getBean("crmCardService");
        for (int i = 0; i < 30000; i++) {
            /** 
             * card valid
             */
            //         CardValidDTO valid = new CardValidDTO();
            //         valid.setCardNo("101001201408024999");
            //         valid.setPartnerId("201407221033072360");
            //         ResponseDTO<CardInfoDTO> validResult =
            //         cardService.checkCardValid(valid);
            //         if (validResult.getCode().equals(ResponseCode.SUCCESS)) {
            //         System.out.println("验证结果:" + validResult.getMessage());
            //         System.out.println("卡套餐:" + validResult.getDataResult().getpCode());
            //         } else {
            //         System.out.println("验证结果:" + validResult.getErrorMsg());
            //         }
            /**
             * card charge
             */
            CommonUserInfoDTO user = new CommonUserInfoDTO();
            user.setGuserId(6512359l);
            user.setUserName("陆凯11");
            user.setiDNo("410124198745511101");
            CardValidDTO valid = new CardValidDTO();
            valid.setCardNo("101001201408020");
            valid.setPartnerId("201407221033072360");
            CardChargeDTO chargedto = new CardChargeDTO();
            chargedto.setCard(valid);
            chargedto.setUser(user);
            ResponseDTO<Boolean> result = cardService.cardCharge(chargedto);
            if (result.getCode().equals(ResponseCode.SUCCESS)) {
                System.out.println(result.getMessage());
                System.out.println(result.getDataResult());
            } else {
                System.out.println(result.getErrorMsg());
            }
            
            try {
                Thread.sleep(100l);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
}
